package com.sure.supermarketserver.security.manager;


import com.sure.supermarketserver.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/security/manager")
public class ManagerAPI {

    @Resource
    private ManagerService managerService;



    //查询
    @GetMapping("")
    public Result managerList(ManagerDto dto){
        Map<String, Object> page =  managerService.getManagerList(dto);
        return Result.success(page);

    }


    //增加
    @PostMapping("")
    public  Result vipAdd(@RequestBody ManagerDto dto){
        managerService.addManager(dto);
        return  Result.success();
    }

    //修改
    @PutMapping("")
    public  Result managerUpdate(@RequestBody ManagerDto dto){
        managerService.updateManager(dto);
        return  Result.success();
    }

    //删除
    @DeleteMapping("/{id}")
    public  Result managerDelete(@PathVariable String id){
        managerService.deleteManager(id);
        return  Result.success();
    }


}
